package com.weiiew.buildservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.weiiew.common.entity.dto.Building;
import com.weiiew.common.entity.qo.BuildingQo;
import com.weiiew.common.entity.simple.NumberPair;
import com.weiiew.common.entity.simple.SimpleBuilding;
import com.weiiew.common.entity.simple.SimpleType;
import com.weiiew.common.entity.vo.BuildingVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author 魏锴
 * @description 针对表【building】的数据库操作Mapper
 * @createDate 2024-02-09 17:56:29
 * @Entity com.example.adminBackEnd.Entity.dao.BuildingVO
 */
@Mapper
public interface BuildingMapper extends BaseMapper<Building> {
    @Select("select id, name from building_type where version = #{version} and state = 1")
    List<SimpleType> getBuildingTypes(Integer version);

    Building getBuildingById(Integer id);

    List<NumberPair> selectPairByBuilding(Integer build_id);
    Integer getBuildingLength(BuildingQo qo);

    List<BuildingVO> getBuildingList(BuildingQo qo);

    void insertBuilding(Building building);
    BuildingVO getDetailBuild(Integer id);

    @Update("update building set icon_url = #{id} where id = #{id}")
    void setIcon(Integer id);

    List<BuildingVO> getBuildingsByCostId(Integer id);


    List<SimpleBuilding> getSimpleBuildingList(BuildingQo qo);
    @Select("select icon_url from building left join building_type bt on bt.id = building.type where version = #{version}")
    List<String> getBuildIconList(Integer version);
}




